<template>
    <BPTable ref='tableRef' align='center' row-key='id' :columns='columns' :api='pageApi' :buttons='buttons'>
        <template #user="{record}">
            <a-space>
                <a-avatar v-if="record.user.avatar" :src="staticUrl + record.user.avatar" />
                <span>{{ record.user.nickname }}</span>
            </a-space>
        </template>
    </BPTable>
</template>

<script lang='ts' setup>
    import { ref } from "vue";
    import { pageApi } from '@/api/recharge/Order'
    import { parseTime } from "@/utils";
// import { CLIENT_SOURCE } from "@/constant";

const staticUrl = import.meta.env.B_NET_STATIC_URL

    const tableRef = ref()


    const buttons = ref<SearchButton[]>([])

    const columns = ref<Column[]>([
        {
            dataIndex : 'orderNo',
            title : '订单号',
            inSearch : true,
        },

        {
            dataIndex : 'user',
            title : '用户',
        },

        // {
        //     dataIndex : 'payChannel',
        //     title : '支付方式',
        //     customRender({text}) {
        //         return CLIENT_SOURCE[text]
        //     }
        // },

        {
            dataIndex : 'amount',
            title : '充值金额(元)',
        },

        {
            dataIndex : 'rewardAmount',
            title : '赠送金额(元)',
        },

        {
            title : '时间',
            dataIndex : 'createTime',
            align : 'center',
            customRender({text}) {
                return parseTime(text)
            }
        }
    ])

    const dataRows = ref<any[]>([])
    
</script>